package com.proj.service.impl;

import com.proj.bean.Category;
import com.proj.dao.CategoryDao;
import com.proj.service.ICategoryService;
import com.proj.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl implements ICategoryService {

    //依赖注入
    @Autowired
    CategoryDao categoryDao;

    @Override
    public int add(Category category) {
        return categoryDao.add(category);
    }

    @Override
    public int del(int id) {
        return categoryDao.del(id);
    }

    @Override
    public int edit(Category category) {
        return categoryDao.edit(category);
    }

    @Override
    public Category getById(int id) {
        return categoryDao.getById(id);
    }

    @Override
    public List<Category> getList(Page page, String text) {
        return categoryDao.getList(page, text);
    }

    @Override
    public List<Category> getChildren(int id) {
        return categoryDao.getChildren(id);
    }

    @Override
    public int getCount(String text) {
        return categoryDao.getCount(text);
    }
}
